
 
 F u n c t i o n :   o n ( d o m E l e m e n t O r N o d e A r r a y O r C S S S e l e c t o r ,   s t r i n g E v e n t N a m e O r K e y V a l u e M a p ,   f u n c t i o n C a l l b a c k ( e v e n t ,   D C ,   s a v e d P a r a m s ) ,   p a r a m s T o S a v e ,   s t r i n g N a m e s p a c e   ) 
 
 
 
 D e s c r i p t i o n :   S e t s   o n e   o r   m o r e   e v e n t   h a n d l e r s   t o   e x i c u t e   w h e n   t r i g g e r e d . 
 
 
 
 R e t u r n s :   d o m E l e m e n t   o r   m a t c h i n g   n o d e   a r r a y ,   o r   $ A   o b j e c t   i f   c h a i n e d . 
 
 
 
 N o t e :   T h e   e v e n t   n a m i n g   s y n t a x   a l s o   s u p p o r t s   e v e n t   n a m e s p a c i n g ,   s o   t h a t   m u l t i p l e   e v e n t s   c a n   b e   a d d e d   u s i n g   t h e   s a m e   n a m e s p a c e   f o r   g r o u p e d   e v e n t s ,   o r   t h e   s t r i n g N a m e s p a c e   p a r a m e t e r   m a y   b e   u s e d   f o r   t h i s   p u r p o s e   i n s t e a d   w h e n   a p p l y i n g   m u l t i p l e   e v e n t   h a n d l e r s . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   B i n d   a n   e v e n t   h a n d l e r   t o   a   D O M   e l e m e n t . 
 
 v a r   m y E l e m e n t   =   $ A . o n ( d o m E l e m e n t ,   " c l i c k " ,   f u n c t i o n ( e v e n t ,   D C )   { 
 
     / /   D C   w i l l   a u t o m a t i c a l l y   p o p u l a t e   I f   a   D C   o b j e c t   i s   b o u n d   t o   t h e   r e f e r e n c e d   e l e m e n t   a s   i t s   t r i g g e r i n g   e l e m e n t . 
 
 } ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   e v e n t s   t o   a   h a n d l e r   o n   D O M   e l e m e n t s   r e f e r e n c e d   w i t h   a   C S S   s e l e c t o r   a n d   s t o r e   a d d i t i o n a l   d a t a 
 
 v a r   m y E l e m e n t s A r r a y   =   $ A . o n ( " a . t o o l t i p - t r i g g e r " ,   " f o c u s   m o u s e o v e r " ,   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
     / /   d a t a   i s   p o p u l a t e d   b y   w h a t e v e r   i s   p a s s e d   i n   t h e   t h i r d   p a r a m e t e r   o f   o n ( ) 
 
     / /   I n   t h i s   c a s e ,   d a t a   =   " T e s t i n g " 
 
 } ,   " T e s t i n g " ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   e v e n t   h a n d l e r s   t o   a   D O M   e l e m e n t . 
 
 v a r   m y E l e m e n t   =   $ A . o n ( d o m E l e m e n t ,   { 
 
     f o c u s :   f u n c t i o n ( e v e n t ,   D C )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     b l u r :   f u n c t i o n ( e v e n t ,   D C )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     m o u s e e n t e r :   f u n c t i o n ( e v e n t ,   D C )   { 
 
         / /   D o   s o m e t h i n g 
 
     } 
 
 } ) ; 
 
 
 
 / /   B i n d   a   n a m e s p a c e d   e v e n t   h a n d l e r   t o   a   D O M   e l e m e n t . 
 
 v a r   m y E l e m e n t   =   $ A . o n ( d o m E l e m e n t ,   " c l i c k . m y N a m e s p a c e " ,   f u n c t i o n ( e v e n t ,   D C )   { 
 
     / /   D o   s o m e t h i n g 
 
 } ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   n a m e s p a c e d   e v e n t s   t o   a   h a n d l e r   o n   D O M   e l e m e n t s   r e f e r e n c e d   w i t h   a   C S S   s e l e c t o r   a n d   s t o r e   a d d i t i o n a l   d a t a 
 
 v a r   m y E l e m e n t s A r r a y   =   $ A . o n ( " a . t o o l t i p - t r i g g e r " ,   " f o c u s . m y N a m e s p a c e   m o u s e o v e r . m y N a m e s p a c e " ,   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
     / /   H e r e ,   d a t a   =   " T e s t i n g " 
 
 } ,   " T e s t i n g " ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   e v e n t s   t o   a   h a n d l e r   o n   D O M   e l e m e n t s   r e f e r e n c e d   w i t h   a   C S S   s e l e c t o r ,   s t o r e   n o   a d d i t i o n a l   d a t a ,   a n d   n a m e s p a c e   a l l   e v e n t s   u s i n g   t h e   s t r i n g N a m e s p a c e   p a r a m e t e r . 
 
 v a r   m y E l e m e n t s A r r a y   =   $ A . o n ( " a . t o o l t i p - t r i g g e r " ,   " f o c u s   m o u s e o v e r " ,   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
 } ,   " . m y N a m e s p a c e " ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   n a m e s p a c e d   e v e n t   h a n d l e r s   t o   a   D O M   e l e m e n t   a n d   s t o r e   a d d i t i o n a l   d a t a . 
 
 v a r   m y E l e m e n t   =   $ A . o n ( d o m E l e m e n t ,   { 
 
     " f o c u s . m y N a m e s p a c e " :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     " b l u r . m y N a m e s p a c e " :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     " m o u s e e n t e r . m y N a m e s p a c e " :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } 
 
 } , 
 
 / /   S t o r e d   d a t a   ( m a y   b e   a n y   o b j e c t   t y p e   e x c e p t   a   f u n c t i o n ) 
 
 " S t o r e d   d a t a " ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   n a m e s p a c e d   e v e n t   h a n d l e r s   t o   a   D O M   e l e m e n t   u s i n g   t h e   s t r i n g N a m e s p a c e   p a r a m e t e r . 
 
 v a r   m y E l e m e n t   =   $ A . o n ( d o m E l e m e n t ,   { 
 
     f o c u s :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     b l u r :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     m o u s e e n t e r :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } 
 
 } ,   " . m y N a m e s p a c e " ) ; 
 
 
 
 / /   O r   t h e   s a m e   u s i n g   c h a i n i n g 
 
 
 
 / /   B i n d   a n   e v e n t   h a n d l e r   t o   a   D O M   e l e m e n t . 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . o n ( " c l i c k " ,   f u n c t i o n ( e v e n t ,   D C )   { 
 
     / /   D C   w i l l   a u t o m a t i c a l l y   p o p u l a t e   I f   a   D C   o b j e c t   i s   b o u n d   t o   t h e   r e f e r e n c e d   e l e m e n t   a s   i t s   t r i g g e r i n g   e l e m e n t . 
 
 } ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   e v e n t s   t o   a   h a n d l e r   o n   D O M   e l e m e n t s   r e f e r e n c e d   w i t h   a   C S S   s e l e c t o r   a n d   s t o r e   a d d i t i o n a l   d a t a 
 
 v a r   m y C h a i n   =   $ A ( " a . t o o l t i p - t r i g g e r " ) . o n ( " f o c u s   m o u s e o v e r " ,   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
     / /   d a t a   i s   p o p u l a t e d   b y   w h a t e v e r   i s   p a s s e d   i n   t h e   t h i r d   p a r a m e t e r   o f   o n ( ) 
 
     / /   I n   t h i s   c a s e ,   d a t a   =   " T e s t i n g " 
 
 } ,   " T e s t i n g " ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   e v e n t   h a n d l e r s   t o   a   D O M   e l e m e n t . 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . o n ( { 
 
     f o c u s :   f u n c t i o n ( e v e n t ,   D C )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     b l u r :   f u n c t i o n ( e v e n t ,   D C )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     m o u s e e n t e r :   f u n c t i o n ( e v e n t ,   D C )   { 
 
         / /   D o   s o m e t h i n g 
 
     } 
 
 } ) ; 
 
 
 
 / /   B i n d   a   n a m e s p a c e d   e v e n t   h a n d l e r   t o   a   D O M   e l e m e n t . 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . o n ( " c l i c k . m y N a m e s p a c e " ,   f u n c t i o n ( e v e n t ,   D C )   { 
 
     / /   D o   s o m e t h i n g 
 
 } ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   n a m e s p a c e d   e v e n t s   t o   a   h a n d l e r   o n   D O M   e l e m e n t s   r e f e r e n c e d   w i t h   a   C S S   s e l e c t o r   a n d   s t o r e   a d d i t i o n a l   d a t a 
 
 v a r   m y C h a i n   =   $ A ( " a . t o o l t i p - t r i g g e r " ) . o n ( " f o c u s . m y N a m e s p a c e   m o u s e o v e r . m y N a m e s p a c e " ,   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
     / /   H e r e ,   d a t a   =   " T e s t i n g " 
 
 } ,   " T e s t i n g " ) ; 
 
 
 
 / /   B i n d   m u l t i p l e   n a m e s p a c e d   e v e n t   h a n d l e r s   t o   a   D O M   e l e m e n t   a n d   s t o r e   a d d i t i o n a l   d a t a . 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . o n ( { 
 
     " f o c u s . m y N a m e s p a c e " :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     " b l u r . m y N a m e s p a c e " :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } , 
 
     " m o u s e e n t e r . m y N a m e s p a c e " :   f u n c t i o n ( e v e n t ,   D C ,   d a t a )   { 
 
         / /   D o   s o m e t h i n g 
 
     } 
 
 } , 
 
 / /   S t o r e d   d a t a   ( m a y   b e   a n y   o b j e c t   t y p e   e x c e p t   a   f u n c t i o n ) 
 
 " S t o r e d   d a t a " ) ; 
 
 
 
 / /   T o   r e t u r n   t h e   m o d i f i e d   e l e m e n t   w i t h i n   a   c h a i n ,   u s e   t h e   " r e t u r n ( ) "   m e t h o d . 
 
 
 
 v a r   m y E l e m e n t   =   m y C h a i n . r e t u r n ( ) ; 
 
 